fun chain1(s: String): String =
s.asSequence()
.map { it.uppercase() }
.filter { it in ("A".."F") }
.map { it.lowercase() }
.joinToString(", ")
| Function Call | Return Value | |||
|---|---|---|---|---|
| chain1("BIKE") | → | |||
| chain1("Elephant") | → | |||
| chain1("garage") | → | |||
| chain1("DECK") | → | |||
| chain1("House") | → | |||
Experiment with this code on Gitpod.io or as a Kotlin Playground